// 1.0 导入vue核心包
import Vue from 'vue';

// 2.0 导入App.vue的vue对象
import App from './App.vue';

// 3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';
// 3.0.1 将vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);
import vueResourse from 'vue-resource'
Vue.use(vueResourse);
// 3.0.2 导入路由规则对应的组件对象
import shopcar from './components/shopcar/shopcar.vue'
import home from './components/home.vue'
import newslist from './components/news/newslist.vue'
import newsDetail from './components/news/newsDetail.vue'
import photoList from './components/photo/photoList.vue'
import photoInfo from './components/photo/photoinfo.vue'
import goodslist from './components/goods/goodslist.vue'
import goodsinfo from  './components/goods/goodinfo.vue'
import goodsdesc from  './components/goods/goodsdesc.vue'

// 3.0.2 定义路由规则
var router1 = new vueRouter({
	linkActiveClass:"mui-active",
	routes:[
		{path:"/",redirect:"/home"},
		{path:"/home",component:home},
		{path:"/photo/photoList",component:photoList},
		{path:"/photo/photoinfo/:id",component:photoInfo},
		{path:"/shopcar",component:shopcar},
		{path:"/news/newslist",component:newslist},
		{path:"/news/newslist/:id",component:newsDetail},
		{path:"/goods/goodslist",component:goodslist},
		{path:"/goods/goodsinfo/:id",component:goodsinfo},
		{path:"/goods/goodsdesc/:id",component:goodsdesc},
	]
	});


// 4.0 注册mint-ui
// 导入mint-ui的css文件
import 'mint-ui/lib/style.min.css';
// 导入mint-ui组件对象
import mintui from 'mint-ui';

// 在Vue中全局使用mintui
Vue.use(mintui);
// 加入时间过滤组件
import moment from 'moment'

Vue.filter("forTime",function(input,type){
	return moment(input).format(type)
})

import VuePreview from 'vue-preview'
Vue.use(VuePreview)

// 5.0 注册mui的css样式
import '../statics/mui/css/mui.css';
import '../statics/css/site.css'

// 5.0 利用Vue对象进行解析渲染
new Vue({
	el:'#app',
	// 使用路由对象实例
	router:router1,
	// render:function(create){create(App)} //es5的写法
	render:c=>c(App)  // es6的函数写法 =>：goes to
});